﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Administration;
using System.Runtime.InteropServices;

namespace motion10.SharePoint.TwitterSupport.Common
{
    [Guid("2F173D68-B595-4CF7-8917-B07B237D88DA")]
    internal class TwitterConsumerKeys : SPPersistedObject
    {
        private const string PersistedObjectName = "TwitterConsumerKeys";
        [Persisted]
        private string _ConsumerKeyName;

        [Persisted]
        private string _ConsumerSecretName;

        /*The default constructor must be specified for serialization.*/
        public TwitterConsumerKeys()
        {
        }
        public TwitterConsumerKeys(SPPersistedObject parent)
            : base(PersistedObjectName, parent)
        {
            ;
        }


        public static TwitterConsumerKeys Local
        {
            get
            {
                SPPersistedObject parent = SPFarm.Local;

                var obj = parent.GetChild<TwitterConsumerKeys>(PersistedObjectName);

                if (obj == null)
                {


                    obj = new TwitterConsumerKeys(parent);
                    obj.Update();

                }
                return obj;
            }
        } 


        public string ConsumerKeyName
        {
            get { return this._ConsumerKeyName; }
            set { this._ConsumerKeyName = value; }
        }

        public string ConsumerSecretName
        {
            get { return this._ConsumerSecretName; }
            set { this._ConsumerSecretName = value; }
        }
    }

}
